package edu.jhu.cs.oose.scheduleit.util;

import java.util.List;

import edu.jhu.cs.oose.scheduleit.vo.Group;
import edu.jhu.cs.oose.scheduleit.vo.Schedule;
import edu.jhu.cs.oose.scheduleit.vo.User;
import edu.jhu.cs.oose.scheduleit.vo.UserInfo;
/**
 * The decorate class for the VO object, Group
 * @author JHYU
 *
 */
public class GroupDecorater extends Group {
	/**
	 * The group which is been decorated
	 */
    Group group;
    /**
     * The joined users for the group
     */
	List<UserInfo> joinedUsers;
	/**
	 * The applying users for the group
	 */
	List<UserInfo> applyingUsers;
	/**
	 * The number of joined users for the group
	 */
	int members;
	/**
	 * The join status for the user
	 */
	JoinStatus status;
	/**
	 * Indicate whether the group have new members applying
	 */
	boolean applying;
	/**
	 * Indicate whether the user is the host of the group
	 */
	boolean owner;
	/**
	 * The constructor for the GroupDecorater
	 * @param group GroupDecorater
	 * @param joinedUsers The joined users for the group
	 * @param members The number of joined users for the group
	 * @param joinStatus The join status for the user
	 * @param applying Indicate whether the group have new members applying
	 * @param applyingUsers Indicate whether the user is the host of the group
	 * @param host The user who gives the group
	 */
	public GroupDecorater(Group group,
			List<UserInfo> joinedUsers, int members, JoinStatus joinStatus, boolean applying, List<UserInfo> applyingUsers,User host) {
		this.group = group;
		this.joinedUsers = joinedUsers;
		this.members = members;
		this.joinedUsers = joinedUsers;
		this.applying = applying;
		this.applyingUsers = applyingUsers;
		this.owner = group.getHost().equals(host.getUserInfo());
		this.status = joinStatus;
	}

	public List<UserInfo> getJoinedUsers() {
		return joinedUsers;
	}

	public int getMembers() {
		return members;
	}

	public JoinStatus getStatus() {
		return status;
	}

	public boolean isApplying() {
		return applying;
	}

	public List<UserInfo> getApplyingUsers() {
		return applyingUsers;
	}

	public boolean isOwner() {
		return owner;
	}

	@Override
	public int compareTo(Group group) {
		// TODO Auto-generated method stub
		return this.group.compareTo(group);
	}

	@Override
	public long getClicks() {
		// TODO Auto-generated method stub
		return this.group.getClicks();
	}

	@Override
	public String getDescription() {
		// TODO Auto-generated method stub
		return this.group.getDescription();
	}

	@Override
	public UserInfo getHost() {
		// TODO Auto-generated method stub
		return this.group.getHost();
	}

	@Override
	public int getId() {
		// TODO Auto-generated method stub
		return this.group.getId();
	}

	@Override
	public JoinRule getJoinRule() {
		// TODO Auto-generated method stub
		return this.group.getJoinRule();
	}

	@Override
	public Schedule getSchedule() {
		// TODO Auto-generated method stub
		return this.group.getSchedule();
	}

	@Override
	public List<String> getTags() {
		// TODO Auto-generated method stub
		return this.group.getTags();
	}

	@Override
	public String getTopic() {
		// TODO Auto-generated method stub
		return this.group.getTopic();
	}
	
	public Group getGroup(){
		return this.group;
	}
}
